/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.trabalho.DAO;

import br.com.trabalho.model.Funcionario;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author Leandro
 */
public class DAOFuncionario extends GenericoDAO {

    public DAOFuncionario() {
    }

    public Boolean verificarFuncionarioRelacionado(Funcionario funcionario) throws HibernateException {
        Session session = hibernateConfiguracao.openSession();
        String str = "select count(*) from tb_cliente"
                + "where funcionario = :funcID ";
        Query sql = session.createQuery(str).setParameter("funcID", funcionario.getId());
        Long x = (Long) sql.uniqueResult();
        return ((Long) sql.uniqueResult() > 0);
    }
}
